﻿using System;
using System.Data;

namespace Smatime.Web.Models
{
    public class CompanyStore : BaseEntity
    {
        public string Name { get; set; }
        public long CompanyId { get; set; }
        public DateTime ClosingTime { get; set; }
        public string WelcomeMessage { get; set; }

        public CompanyStore()
        {
            this.RowStatus = 1;
        }

        public override BaseEntity FromDataRow(DataRow row)
        {
            Id = (long) row["Id"];
            Name = row["Name"].ToString();
            CompanyId = (long) row["CompanyId"];
            ClosingTime = (DateTime) row["ClosingTime"];
            WelcomeMessage = row["WelcomeMessage"].ToString();
            return base.FromDataRow(row);
        }

        public override void ToDataRow(DataRow row)
        {
            row["Name"] = Name;
            row["CompanyId"] = CompanyId;
            row["ClosingTime"] = ClosingTime;
            row["WelcomeMessage"] = WelcomeMessage;
            row["RowStatus"] = RowStatus;
            base.ToDataRow(row);
        }
    }
}